package com.hong.spring.aop.service.impl;

import com.hong.spring.aop.common.DataResponse;
import com.hong.spring.aop.service.UserService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @Auther: csh
 * @Date: 2020/7/14 16:30
 * @Description:用户服务实现
 */
@Service("userService")
public class UserServiceImpl implements UserService {
    @Override
    public DataResponse<Boolean> login(String username, String password) {
        System.out.println("login：用户账号"+username+"密码:"+password);
        if(StringUtils.isEmpty(username)|| StringUtils.isEmpty(password)){
            throw  new NullPointerException("账号或密码为空!");
        }
        return DataResponse.BuildSuccessResponse(true);
    }

    @Override
    public DataResponse <Boolean> register(String username, String password) {
        System.out.println("register：用户账号"+username+"密码:"+password);
        return DataResponse.BuildSuccessResponse(true);
    }
}
